Skip to main content
Feedback

Debugging SDK Processor Remotely using Java Debugger (introduced in v6.1.0)

Preparing Traffic Manager Container

warning

Do not enable remote debugger in production or cloud environments, as it can open insecure ports. If you want to enable it, then enable it only in dev environments, i.e. on your local machine.

  1. Set allowRemoteDebugger to true in trafficmanager subchart values or overrides file. We recommended using overrides file.

  2. Tunnel the trafficmanager service port for allowing connections to the Java Debugger(JDB) port depending on the value of jdbservice port in trafficmanager subchart values.

kubectl port-forward svc/trafficmanager-svc <local port>:<jdbservice port>

In the above command:

  • localport is the port to which the JDB will connect.

  • jdbservice port is the port exposed via the trafficmanager service

For example, kubectl port-forward svc/trafficmanager-svc 8001:8002

Prepare the IDE

note

The following example use the local port 8001. Replace the 8001 port in the below example with your local port.

Example

Eclipse

  1. Open IDE and configure the debugger to connect to a remote port.

  2. Click Debug Configurations. The Debug Configurations window opens.

  3. Click Remote Java Application.

  4. Click New button for creating a new configuration. The right side of the screen displays options.

  5. In the Connect tab, click Browse to select the Project. In the Project Selection window, select the SDK Processor's project.

  6. In the Connection Properties, for Host, input the node's IP and for Port, input 8001. Click Apply and then click Debug.

IntelliJ Idea

  1. From the main menu, click Run option and select Edit Configuration.

  2. Click the button and select Remote from the configuration list.

  3. In the Run/Debug Configurations window, click SDK Debug in the tree structure and provide the following values:

    1. In Debugger mode, select Attach to remote JVM.

    2. In Host, enter the node's IP.

    3. In Port, enter 8001.

    On successful completion, you can see the toolbar in the IntelliJ Idea window. Click the green debug icon to debug.

Apache NetBeans

  1. In the NetBeans window, click Debug menu, and then click Attach Debugger. The Attach dialog box opens.

  2. Provide the values in Debugger, Connector, and Transport fields.

  3. For Host, input the node's IP and for Port, input 8001.

  4. Click OK. The debug view opens. Set the required breakpoints in the processor code and call an end point.

Fix, Build, Push, Deploy new or Upgrade

This section includes steps on how to fix the adapter code in case of issues in the application.

Fix

Fix the issues found on debugging by fixing the code.

Build Adapter

Build the adapter using SDK scripts. Run the built script.

$ cd <Mashery local SDK extract location>/MasheryLocalSDK 
$ ./build-adapter.sh

Build and Push new Traffic Manager image

Build and push a new trafficmanager image.

  1. Copy the newly build adapter to assemblies.
cp <mashery local sdk extract location>/MasheryLocalSDK/dist/customer-extension.zip <APIML 6.1.0 extract location>/assemblies

  1. Verify if the new build is added to the correct location.
ls -lart <APIML 6.1.0 extract location>/assemblies

  1. Check if the customer-extension.zip file has a new time stamp.

  2. Build only trafficmanager image with a new tag.

cd <APIML 6.1.0 extract location>/. /build-images.sh -i apim-le-trafficmanager -s <new tag>

  1. Push the new image to the repository.

Deploy new or upgrade an existing application

If you are only upgrading the trafficmanager, use helm upgrade command instead of helm install command.

  1. Change the tag for trafficmanager image in the overrides file or trafficmanager subchart values or main values. We recommend using overrides file.

  2. Upgrade the application.

helm upgrade <deployment name> <deployment folder> [optionally - list of overrides files]

On this Page